﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Drawing;

namespace DisplayWord.Helper
{

    class Position
    {
        public enum EnumPos{
            TopLeft = 1,
            TopRight = 2,
            BottomLeft = 3,
            BottomRight = 4
        }

        public static void SetPosition(Form form, EnumPos pos) {
            switch (pos)
            {
                case EnumPos.TopLeft:
                    form.Location = new Point(0,0);
                    break;
                case EnumPos.TopRight:
                    form.Location = new Point(Screen.PrimaryScreen.Bounds.Width - form.Width, 0);
                    break;
                case EnumPos.BottomLeft:
                    form.Location = new Point(0, Screen.PrimaryScreen.Bounds.Height - form.Height);
                    break;
                case EnumPos.BottomRight:
                    form.Location = new Point(Screen.PrimaryScreen.Bounds.Width 
                        - form.Width, Screen.PrimaryScreen.Bounds.Height - form.Height - GetTaskBarHeight());
                    break;
                default:
                    break;
            }
        }

        private static int  GetTaskBarHeight() {
            return Screen.PrimaryScreen.Bounds.Bottom - Screen.PrimaryScreen.WorkingArea.Bottom;
        }
    }
}
